home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / gate / RCS / Gate_ByDesc.c,v < prev    next >
Encoding:
Text File  |  1992-06-05  |  2.0 KB  |  92 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     92.06.04.22.03.19;  author jhh;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/* 
  26.  * Gate_ByDesc.c --
  27.  *
  28.  *    Source code for the Gate_ByDesc library procedure.
  29.  *
  30.  * Copyright 1988 Regents of the University of California
  31.  * Permission to use, copy, modify, and distribute this
  32.  * software and its documentation for any purpose and without
  33.  * fee is hereby granted, provided that the above copyright
  34.  * notice appear in all copies.  The University of California
  35.  * makes no representations about the suitability of this
  36.  * software for any purpose.  It is provided "as is" without
  37.  * express or implied warranty.
  38.  */
  39.  
  40. #ifndef lint
  41. static char rcsid[] = "$Header: /user6/voelker/src/hosttest/RCS/Gate_ByDesc.c,v 1.1 92/03/26 19:43:21 voelker Exp Locker: voelker $ SPRITE (Berkeley)";
  42. #endif not lint
  43.  
  44. #include <stdio.h>
  45. #include <gate.h>
  46. #include <gateInt.h>
  47. #include <string.h>
  48.  
  49.  
  50. /*
  51.  *-----------------------------------------------------------------------
  52.  *
  53.  * Gate_ByDesc --
  54.  *
  55.  *    Return information about a gateway based on its description.
  56.  *
  57.  * Results:
  58.  *    A Gate_Entry pointer describing the gateway, or NULL if no such gateway
  59.  *    exists in the current database.  The Gate_Entry is statically
  60.  *    allocated, and may be modified on the next call to any Gate_
  61.  *    procedure.
  62.  *
  63.  * Side Effects:
  64.  *    The gateway file is opened if it wasn't already.
  65.  *
  66.  *-----------------------------------------------------------------------
  67.  */
  68.  
  69. Gate_Entry *
  70. Gate_ByDesc(desc)
  71.     register char     *desc;      /* Name of gateway to find */
  72. {
  73.     register Gate_Entry    *entry;        /* Current entry */
  74.     register char     **cpp;        /* Pointer to alias table */
  75.  
  76.     if (Gate_Start() != 0) {
  77.     return ((Gate_Entry *)NULL);
  78.     }
  79.     
  80.     while (1) {
  81.     entry = Gate_Next();
  82.     if (entry != (Gate_Entry *)NULL) {
  83.         if (strcmp(entry->desc, desc) == 0) {
  84.         return (entry);
  85.         }
  86.     } else {
  87.         return (Gate_Entry *) NULL;
  88.     }
  89.     }
  90. }
  91. @
  92.